import request from '@/utils/request'
import Qs from 'qs'

const fileApi = {
  list: params => request({
    url: `file?${Qs.stringify(params)}`,
    method: 'get',
    data: { notLoading: true }
  }),

  
  getFile: params => request({
    url: `api/getFile?${Qs.stringify(params)}`,
    method: 'get',
    data: { notLoading: true }
  }),
  
  addDownCount: params => request({
    url: `api/addDownCount`,
    method: 'get',
    params,
    data: { notLoading: true }
  }),

  getRankAvg: params => request({
    url: `file/getRankAvg?${Qs.stringify(params)}`,
    method: 'get',
    data: { notLoading: true }
  }),
  getCtime: params => request({
    url: `file/getCtime`,
    method: 'get',
    data: { notLoading: true }
  }),
  save: data => request({
    url: `file`,
    method: 'post',
    data
  }),
  update: data => request({
    url: `file`,
    method: 'put',
    data
  }),
  remove: id => request({
    url: `file/${id}`,
    method: 'delete'
  })
}

export default fileApi
